package com.example.photobrowser;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;

public class PictureView extends Activity {
	
	@SuppressLint("NewApi")
	protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.picture_view);
        
        // get intent data
 		Intent i = getIntent();

 		// Selected image id
 		int position = i.getExtras().getInt("id");
        	
 		ImageAdapter imageAdapter = new ImageAdapter(this);

 		ImageView imageView = (ImageView) findViewById(R.id.imageView);
 		imageView.setImageResource((int) imageAdapter.getItemId(position));
        
 		String path = imageView.getResources().getString((int) imageAdapter.getItemId(position));
 		StringBuilder builder = MainActivity.getExifStringOutput(path);
 		alert(builder);
	}
	
	public void alert(StringBuilder builder){
	new AlertDialog.Builder(this)
    .setIcon(R.drawable.ic_launcher)
    .setTitle("EXIF")
    .setMessage(builder.toString())
    .setPositiveButton("OK", 
      new DialogInterface.OnClickListener() {
       
       @Override
       public void onClick(DialogInterface dialog, int which) {
        // TODO Auto-generated method stub
       }
      }).show();
	}
	
}
